<SCRIPT type="text/javascript" src="/view/javascripts/form.js"></SCRIPT>
<DIV class="block">
	<H1>Сотрудники университета</H1>
	<TABLE>
		<TR>
			<TH>Имя пользователя</TH>
			<TH>Фамилия</TH>
			<TH>Имя</TH>
			<TH>Отчество</TH>
			<TH>Должность</TH>
		</TR>
<?php
foreach($response->getParameter('persons') as $person) {
	$id = $person->getIdentity();
	$login = $person->getLogin();
	$surname = $person->getSurname();
	$name = $person->getName();
	if($person->getPatronymic() !==null) {
		$patronymic = $person->getPatronymic();
	} else {
		$patronymic = '';
	}
	$posts = $person->getPosts();
	$editId = 'edit-'.$id;
?>
		<TR onclick="submitForm('<?php echo $editId;?>')">
			<TD>
				<FORM action="/person/edit.html" method="post" id="<?php echo $editId;?>">
					<INPUT type="hidden" name="identity" value="<?php echo $id;?>">
				</FORM>
				<?php echo $login;?>
			</TD>
			<TD><?php echo $surname;?></TD>
			<TD><?php echo $name;?></TD>
			<TD><?php echo $patronymic;?></TD>
			<TD>
<?php
	if(count($posts) > 0) {
		echo $posts[0]->getName();
	} else {
?>
				&nbsp;
<?php
	}
?>
			</TD>
		</TR>
<?php
}
?>
	</TABLE>
</DIV>
<DIV class="block">
	<FORM action="/person/edit.html" method="post">
		<BUTTON type="submit">
			<IMG src="/view/img/button-new.png" alt="">
			<SPAN>новый</SPAN>
		</BUTTON>
	</FORM>
</DIV>